"""牛客网 - 识别有效的IP地址和掩码并进行分类统计：
https://www.nowcoder.com/practice/de538edd6f7e4bc3a5689723a7435682?tpId=37&tqId=21241&tPage=1&rp=&ru=/ta/huawei&qru=/ta/huawei/question-ranking
"""

import sys
l = [
    str(int("00000000", 2)), 
    str(int("11111110", 2)), 
    str(int("11111100", 2)), 
    str(int("11111000", 2)), 
    str(int("11110000", 2)), 
    str(int("11100000", 2)), 
    str(int("11000000", 2)), 
    str(int("10000000", 2)), 
    ]
def check_ip(ip_list):
    if len(ip_list) !=4 or "" in ip_list:
        return False
    for i in range(4):
        if int(ip_list[i]) < 0  or int(ip_list[i])>255:
            return False
        else:
            return True

def check_mask(ms_list):
    if len(ms_list) != 4:
        return False
    if ms_list[0] == "255":
        if ms_list[1] == "255":
            if ms_list[2] == "255":
                if ms_list[3] in l:
                    return True
                else:
                    return False
            elif ms_list[2] in l and ms_list[3] == "0":
                return True
            else:
                return False
        elif (ms_list[1] in l) and (ms_list[2]==ms_list[3]=="0"):
            return True
        else:
            return False
    elif (ms_list[0] in l) and (ms_list[1]==ms_list[2]==ms_list[3]=="0"):
        return True
    else:
        return False
                
A, B, C, D, E, error, private = 0, 0, 0, 0, 0, 0, 0
while True:
    line = sys.stdin.readline().strip()
    if line == "":
        break
    ip = line.split("~")[0].split(".")
    ms = line.split("~")[1].split(".")

    #check ip
    if check_ip(ip) and check_mask(ms):
        if 1<= int(ip[0]) <=126:
            A+=1
        if 128<= int(ip[0]) <=191:
            B+=1
        if 192<= int(ip[0]) <=223:
            C+=1
        if 224<= int(ip[0]) <=239:
            D+=1
        if 240<= int(ip[0]) <=255:
            E+=1
        if int(ip[0]) == 10 or (int(ip[0])==172 and 16<=int(ip[1])<=31) or (int(ip[0])==192 and int(ip[1])==168):
            private +=1
    else:
        error+=1
print("{0} {1} {2} {3} {4} {5} {6}".format(A,B,C,D,E,error,private))
    